const gulp = require('gulp');
const htmlmin = require('gulp-htmlmin');
const rename = require('gulp-rename');
const cssmin = require('gulp-cssmin');
const uglify = require('gulp-uglify');
const imagemin = require('gulp-imagemin');
const watch = require('gulp-watch');
// const sprite = require('gulp-sprite');
// const concat = require('gulp-concat');
// const path = require('path');
// const less = require('gulp-less')

gulp.task('htmlmin', () => {
    return gulp.src('./src/html/*.html')
        .pipe(htmlmin({ collapseWhitespace: true }))
        .pipe(gulp.dest('./dist/html'));
});

gulp.task('cssmin', () => {
    return gulp.src('./src/css/*.css')
        .pipe(cssmin())
        .pipe(rename({ suffix: '.min' }))
        .pipe(gulp.dest('./dist/css'))
});

gulp.task('jsmin', () => {
    return gulp.src('./src/js/**/*.js')
        .pipe(uglify())
        .pipe(rename({ suffix: '.min' }))
        .pipe(gulp.dest('./dist/js'))
});

gulp.task('imagemin', () => {
    return gulp.src('./src/img/*.png')
        .pipe(imagemin())
        .pipe(gulp.dest('./dist/img'))
});


gulp.task('watch', () => {
    gulp.watch('./src/js/**/*.js', gulp.series('jsmin'));
});